﻿using System;
using System.Collections.Generic;
using System.Net.Mime;
using System.Text;
using System.Web;
using System.Web.Mvc;
using MiniWeb.Core.Dtos;
using MiniWeb.Core.Entities;
using MiniWeb.Core.Enums;
using MiniWeb.Task;
using System.Linq;
using MiniWeb.Web.Controllers.Code;
using MiniWeb.Web.Controllers.Web.web.ViewModels;
using WFramework;
using WFramework.Common;
using WFramework.MvcPager;
using WFramework.ORM;
using WFramework.Utility;

namespace MiniWeb.Web.Controllers.Web.Help
{
   public class HelpController:BaseController
    {
        private readonly NewsTypeTask _newsTypeTask = new NewsTypeTask();
        private readonly NewsTask _newsTask = new NewsTask();
        public ActionResult Index(int? id)
        {
            id = id ?? 1;
           
            ViewData["typelist"] =_newsTypeTask.GetAll(30,null,null);

            var model = _newsTask.GetCModel((int)id);

            return View(model);
        }
       public ActionResult Show(int id)
        {
            var model = _newsTask.GetById(id);
            if (model == null)
            {
                return RedirectToAction("Index", "Home");
            }
            ViewData["typelist"] = _newsTypeTask.GetAll(30, null, null);

            return View(model);
       }
    }
}
